using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class StartManager : MonoBehaviour
{
    public GameObject bag;
    public Text item_1_num;
    public Text item_2_num;
    public Text item_3_num;
    public Text Glod_num;

    public GameSystem system;
    void Start()
    {
        system = GameObject.Find("System").GetComponent<GameSystem>();
    }
    private void Update()
    {
        item_1_num.text = system.item_1.ToString();
        item_2_num.text = system.item_2.ToString();
        item_3_num.text = system.item_3.ToString();
        Glod_num.text = system.glod.ToString();
    }
    public void Start_Button()
    {
        SceneManager.LoadScene("Game");
    }
    public void Exit_Game()
    {
        Application.Quit();
    }
    public void Open_bag()
    {
        bag.SetActive(true);
    }
    public void Close_bag()
    {
        bag.SetActive(false);
    }

    public void Sell_1()
    {
        if (system.item_1 > 0)
        {
            system.item_1--;
            system.glod += 1;
        }
    }
    public void Sell_2()
    {
        if (system.item_2 > 0)
        {
            system.item_2--;
            system.glod += 2;
        }
    }
    public void Sell_3()
    {
        if (system.item_3 > 0)
        {
            system.item_3--;
            system.glod += 3;
        }
    }
}
